package top.yongyan0624.task;

import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;
import top.yongyan0624.service.CountService;
import top.yongyan0624.service.StarService;

/**
 * @author Yongyan
 * @description: TODO
 * @date 2021/5/19
 **/
public class CountAndStarTask extends QuartzJobBean {

    @Autowired
    private CountService countService;

    @Autowired
    private StarService starService;

    //定时器任务方法：每隔一段时间把redis缓存数据持久化到mysql
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        countService.transCountFromRedis();
        countService.transCountInfoFromRedis();

        starService.transStarFromRedis();
        starService.transStarInfoFromRedis();
    }
}
